package controller;

import bean.RankingInfo;
import biz.RankingBiz;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import util.PreAddCallback;

import java.util.List;

@Controller
@RequestMapping("/ranking")
public class RankingController {

    @Autowired
    private RankingBiz rb;
    @RequestMapping(value="/findRanking")
   @ResponseBody
    public String findRanking(String callback) {

         rb.findRanking();
         return PreAddCallback.preAddCallback(JSONArray.toJSONString(rb.findRanking()),callback);
    }

    @RequestMapping(value="/getRanking")
    @ResponseBody
    public String  getRanking(String callback){
        return PreAddCallback.preAddCallback(JSONArray.toJSONString(rb.getRanking()),callback);
    }
}
